約 4,106,929 件
https://w.atwiki.jp/arduino/pages/53.html
http //www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1206874649/all ↓ http //www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235125412 ↓ http //www.arduino.cc/playground/Learning/SDMMC ↓ http //blushingboy.net/p/SDuFAT/ ↓ なんか微妙。 FileLogger todoこれ試す。 http //www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1240704747/all http //code.google.com/p/arduino-filelogger/ fat16lib これもよさそう。 http //www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1251814823 http //code.google.com/p/fat16lib/
https://w.atwiki.jp/arduino/pages/31.html
Arduinoギャラリー
https://w.atwiki.jp/arduino/pages/57.html
http //www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1224777046
https://w.atwiki.jp/arduino/pages/40.html
ArduinoとLa Fonera(FON2201)をつなぐ。 ふたを開ける。 星形ドライバ。macbookのHDD交換の時につかったやつ(T8)でOK。 本体裏側のゴムの後ろに隠れているのを2個外せば簡単に開く。 電源 FON2201に付属のACアダプタは7.5V 1A。ルータ本体の表示も7.5V 1A。 シリアルコンソール (直接digital0,digital1につなぐ方法のほうがよいかもしれない→このページの下の方参照) http //www.churadesign.com/2008/05/19/arduino%E3%81%A7fon%E3%81%A8%E3%82%B7%E3%83%AA%E3%82%A2%E3%83%AB%E9%80%9A%E4%BF%A1dd-wrt%E5%8C%96/ http //blog.gcd.org/archives/51109295.html FON2201の4ピンはLANコネクタ側から順番に「NC,Tx,Rx,GND」だそうで、 Txとdigital2、Rxとdigital3、GNDとGNDをつなぐ。 availableが使えるSoftwareSerialを使って、 http //arduiniana.org/libraries/NewSoftSerial/ /* FON */ #include NewSoftSerial.h #define rxPin 2 #define txPin 3 #define ledPin 13 NewSoftSerial mySerial(rxPin, txPin); void setup() { pinMode(ledPin, OUTPUT); pinMode(rxPin, INPUT); pinMode(txPin, OUTPUT); Serial.begin(9600); mySerial.begin(9600); } void loop() { if(mySerial.available()){ Serial.print((char)mySerial.read()); } if(Serial.available()){ mySerial.print((char)Serial.read()); } } このスケッチを動かして、 screen /dev/tty.usbserial* で、FON2201の電源を入れると、 +Ethernet eth0 MAC address 00 18 84 a4 36 d0 IP 192.168.1.1/255.255.255.0, Gateway 0.0.0.0 Default server 192.168.1.254 RedBoot(tm) bootstrap and debug environment [ROMRAM] OpenWrt certified release, version 1.1 - built 22 32 28, May 7 2007 Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. Board FON 2201 RAM 0x80000000-0x81000000, [0x80040290-0x80e1000]availble LASH 0xa800000 0xa8f0000,128 bocks o 0x0010000bytes ach. == Eecutig boo scrip in 2000 seonds ente ^C toabot RedBoot fis load -b 0x80100000 loader RedBoot go 0x80100000 Failsafe loader v0.2 Looking for board config data... found at offset 0xa87f0000 Reset button GPIO 6 Reading flash from 0xa8040000 to 0xa825c4e9... done. Verifying CRC... OK - 0x7fd5bb48 Uncompressing Linux... Ok, booting the kernel. [sighandler] No more events to be processed, quitting. [cleanup] Waiting for children. [cleanup] All children terminated. Unlocking rootfs ... Could not open mtd device rootfs switching to jffs2 init started BusyBox v1.4.1 (2007-09-26 18 40 28 CEST) multi-call binary ifconfig SIOCSIFADDR No such device ifconfig SIOCSIFADDR No such device udhcpc (v1.4.1) started route fscanf Sending discover... Sending discover... なんかブートしてる。 OpenWRTかDD-WRTか なにが違うのかよくわからないが、DD-WRTのほうが情報が多そうなのでDD-WRT。 macでFON2201にdd-wrtをインストール FONまとめwikiのDD-WRTのページ( http //fon-wiki.maniado.com/index.php?DD-WRT )を参考に進める。 http //www.dd-wrt.com/ http //www.dd-wrt.com/wiki/index.php/LaFoneraPlus_Software_Flashing 2009/5/3の時点でFON用の最新は「v24 SP1」。 http //www.dd-wrt.com/dd-wrtv2/down.php?path=downloads%2Fstable%2Fdd-wrt.v24+SP1%2FConsumer%2FFon%2FFonera/ インストール作業時は、 FON2201のWANポートとmacをLANケーブルで直接接続し、 macの有線LANを固定で192.168.1.11/255.255.255.0、FON2201を192.168.1.22/255.255.255.0に設定している。 (mac) cd ~/tmp mkdir ddwrt cd ddwrt wget http //www.dd-wrt.com/dd-wrtv2/downloads/stable/dd-wrt.v24%20SP1/Consumer/Fon/Fonera/fonera-firmware.bin wget http //www.dd-wrt.com/dd-wrtv2/downloads/stable/dd-wrt.v24%20SP1/Consumer/Fon/Fonera/fonera_flashing.txt wget http //www.dd-wrt.com/dd-wrtv2/downloads/stable/dd-wrt.v24%20SP1/Consumer/Fon/Fonera/linux.bin sudo /sbin/service tftp start sudo cp linux.bin /private/tftpboot/ (シリアルコンソールでRedBoot起動直後にCtrl-C) ip_address -l 192.168.1.22/24 -h 192.168.1.11 fis init load -r -v -b 0x80041000 linux.bin (mac) sudo /sbin/service tftp stop sudo rm /private/tftpboot/linux.bin (シリアルコンソール) RedBoot fis create linux ←30分かかる RedBoot fconfig Run script at boot true Boot script .. fis load -b 0x80100000 loader .. go 0x80100000 Enter script, terminate with empty line fis load -l linux (←ここ入力) exec (←ここ入力) (←ここ入力) Boot script timeout (1000ms resolution) 2 Use BOOTP for network configuration false Gateway IP address Local IP address 192.168.1.1 Local IP address mask 255.255.255.0 Default server IP address 192.168.1.254 Console baud rate 9600 GDB connection port 9000 Force console for special debug messages false Network debug at boot time false Update RedBoot non-volatile configuration - continue (y/n)? y (←ここ入力) ... Erase from 0xa87e0000-0xa87f0000 . ... Program from 0x80ff0000-0x81000000 at 0xa87e0000 . RedBoot reset FON2201がリブートした後、http //192.168.1.1/を開けば管理画面が出る。 9600bps http //echodittolabs.org/hacking-la-fonera-2 stty -F /dev/tts/0 9600 「管理→コマンド実行」からコマンド入力すればコンソールが9600bpsになってなんとか使えるようになる。 が、ちょっと文字化けする。 DuemilanoveのUSBシリアルで直接通信する DD-WRT本体のコンソールの通信速度が115200なので上のスケッチ経由だと文字化けする。 なにもしないスケッチを動作させておいて、 Txとdigital1、Rxとdigital0、GNDとGNDをつないで screen /dev/tty.usbserial* 115200 とすればOK. FON2201を無線クライアントにする FON2201には普通の無線LANクライアントになってもらいたい。 もともとある家のルータ(親ルータ)を経由して家庭内LAN、インターネットに接続する。 基本→基本 インターネット接続 手動 or DHCP ... LAN側接続→IPアドレス 他とかぶらないように (固定にするなり、親ルータ側で固定なDHCPで振るなり・・・) 無線LAN→基本 Regulatory Domain JAPAN 無線LAN MAC動作モード Client ネットワーク名 (SSID) 親ルータのSSID 無線LAN→無線LANセキュリティ 自分の設定に。 セキュリティ→Firewall保護 SPI Firewall 無効 ArduinoとFON2201でシリアル通信 DDWRTがログインプロンプトを出すし、動作状態のログ的なものが出てくる。 これらをOFFにしてArduinoとのやりとり専用にしたい。 http //www.geocities.jp/arduino_diecimila/wifi/index.html ログインプロンプトからDDWRTにログインし、telnetしている。 管理画面でボタンをおしたりしない限り余計な出力は無いのかも? http //blog.xole.net/article.php?id=689 ruby入れられるかなあ。 http //www.dd-wrt.com/wiki/index.php/Ipkg 以外に簡単に入るかもしれない。 ipkg jffs http //www.dd-wrt.com/wiki/index.php/Jffs flash領域にデータを保存するファイルシステム。 flashなのであまりたくさん書き換えると壊れちゃう? (SDカード増設する方法もあるみたい。 http //www.dd-wrt.com/wiki/index.php/LaFonera_Hardware_SD-Card ) とりあえず、内蔵flashで試す。 管理→管理の「JFFS2 の設定」で、 1. 「JFFS2」を「有効」(「JFFS2の保存領域を初期化」は無効のまま) 2. 設定(保存のみ) を押す。 3. 設定 を押す。 4. 「JFFS2の保存領域を初期化」を「有効」 5. 設定 を押す。領域がフォーマットされる。設定(保存のみ)は押さない! 6. 「JFFS2の保存領域を初期化」を「無効」 7. 設定(保存のみ) を押す。 8. 再起動 を押す。 (前) root@DD-WRT ~# df -h Filesystem Size Used Available Use% Mounted on rootfs 5.4M 5.4M 0 100% / /dev/root 5.4M 5.4M 0 100% / (後) root@DD-WRT ~# df -h Filesystem Size Used Available Use% Mounted on rootfs 5.4M 5.4M 0 100% / /dev/root 5.4M 5.4M 0 100% / /dev/mtdblock/3 1.4M 196.0k 1.2M 13% /jffs これで/jffs以下に書き込み可能になった。 rubyのパッケージ http //downloads.openwrt.org/kamikaze/8.09/atheros/packages/ にあった。 まずは練習でram(/tmp)にインストールしてみる。 cd /tmp wget http //downloads.openwrt.org/kamikaze/8.09/atheros/packages/ruby_1.8.6-p36-1_mips.ipk ipkg -d ram install ruby_1.8.6-p36-1_mips.ipk rm ruby_1.8.6-p36-1_mips.ipk wget http //downloads.openwrt.org/kamikaze/8.09/atheros/packages/ruby-core_1.8.6-p36-1_mips.ipk ipkg -d ram install ruby-core_1.8.6-p36-1_mips.ipk rm ruby-core_1.8.6-p36-1_mips.ipk wget http //downloads.openwrt.org/kamikaze/8.09/atheros/packages/libruby_1.8.6-p36-1_mips.ipk ipkg -d ram install libruby_1.8.6-p36-1_mips.ipk rm libruby_1.8.6-p36-1_mips.ipk LD_LIBRARY_PATH=/tmp/usr/lib /tmp/usr/bin/ruby -v LD_LIBRARY_PATH=/tmp/usr/lib /tmp/usr/bin/ruby -e "p hello from FON2201. " 成功。動きますな。 http //downloads.openwrt.org/kamikaze/8.09/atheros/packages/ruby-cgi_1.8.6-p36-1_mips.ipk http //downloads.openwrt.org/kamikaze/8.09/atheros/packages/ruby-erb_1.8.6-p36-1_mips.ipk http //downloads.openwrt.org/kamikaze/8.09/atheros/packages/ruby-webrick_1.8.6-p36-1_mips.ipk しかし、 (before) root@DD-WRT /tmp# du -h -s 116.0k . (after) root@DD-WRT /tmp# du -h -s 3.4M . root@DD-WRT /tmp# df -h Filesystem Size Used Available Use% Mounted on rootfs 5.4M 5.4M 0 100% / /dev/root 5.4M 5.4M 0 100% / /dev/mtdblock/3 1.4M 196.0k 1.2M 13% /jffs 入らなさそう。 FONにSDカードを増設 結構大変そうなのでやりたくない。特にFON2201の情報がない。GPIOの場所すらわからない。 2100/2200 http //www2omshiva.dyndns.org 8080/openwrt-fonera-sd 画像 http //home.earthlink.net/~fone/f/fourneras.jpg その他 La FoneraのGPIOでAVRに書き込む http //d.hatena.ne.jp/ts1/20090409/1239287090 LaFonera改造大全集 http //www.dd-wrt.com/wiki/index.php/Category LaFonera_Hardware_(en) すげー
https://w.atwiki.jp/arduino/pages/22.html
ArduinoをAVRライタとして使う Arduino Duemilanoveと「AVRライタにするスケッチ」を使って C言語で開発したプログラムをtiny2313vに書き込みます。 1. 配線 Arduino tiny2313V 色 5V Vcc(20) 赤 Gnd GND(10) 黒 13 SCK(19) 青 12 MISO(18) 緑 11 MOSI(17) 黄 10 RESET(1) 白 2. スケッチを実行 http //www15.atwiki.jp/arduino?cmd=upload act=open pageid=22 file=AVRProg.pde を実行する。 3. TODO avrdudeで使えるプロトコルを実装する。 参考サイト http //arms22.blog91.fc2.com/blog-entry-219.html http //www.arduino.cc/playground/Code/Programmer2 http //www.arduino.cc/playground/uploads/Code/programmer2.txt
https://w.atwiki.jp/arduino/pages/48.html
Arduinoで簡易的なオシロスコープ的なことができます。 試してみる http //accrochages.drone.ws/en/node/90 これを元に作られたアプリを http //code.google.com/p/arduinoscope/ ここからダウンロードできます。 Arduinoに入れるスケッチ http //arduinoscope.googlecode.com/files/arduino_oscilliscope.pde オシロアプリ http //arduinoscope.googlecode.com/files/application.macosx.zip http //arduinoscope.googlecode.com/files/application.linux.zip http //arduinoscope.googlecode.com/files/application.windows.zip Arduinoで新規スケッチ作成し、arduino_oscilliscope.pdeをコピペし保存。実行。 オシロアプリを起動!で普通は動きそうだがだめだった。 Processingで実行 ウインドウのサイズとかチャンネル数とかを変えたいし。 Processingを入れる。http //www.processing.org/download/ 1.0.5 インストールしてなにかサンプルを実行してみる。 controlP5ライブラリを入れる。http //www.sojamo.de/libraries/controlP5/ 解凍して、[processingのSketchbookフォルダ]/libraries/controlP5となるように配置。 arduinoscope.pde オシロアプリのZIPの中にあるarduinoscope.pdeをコピーしてProcessingで実行する。 Fontの作成 Fontデータをを自分で作る必要がある。 http //labs.uechoco.com/blog/2008/02/processingvlw.html 好きなフォントデータを作ってソースのフォント名を直して再実行。 シリアル通信速度の変更 ArduinoのスケッチとProcessingのスケッチの中にある速度指定の値を2カ所書き換える。 デフォルトでは115200になっているが、このままだと信号の波形がガタガタだった。 38400まで落とすとなめらかになった。
https://w.atwiki.jp/ylabarduino/pages/13.html
Arduino Arduinoの派生物 その他マイコン
https://w.atwiki.jp/arduino/pages/20.html
Arduino実験セット 部品をそろえよう LEDチカチカ Arduino Duemilanove http //www.switch-science.com/products/detail.php?product_id=3 USBケーブル 100円ショップ。 LEDたくさんチカチカ ブレッドボード http //akizukidenshi.com/catalog/g/gP-00285/ 700円 http //akizukidenshi.com/catalog/g/gP-01992/ 1100円 http //akizukidenshi.com/catalog/g/gP-00284/ 1400円 http //akizukidenshi.com/catalog/g/gP-00283/ 2000円 http //akizukidenshi.com/catalog/c/cbread/ 配線ケーブル ↑に付属のやつでもOK http //www.switch-science.com/products/detail.php?product_id=57 LED http //akizukidenshi.com/catalog/g/gI-01222/ 青5個100円 http //akizukidenshi.com/catalog/g/gI-02082/ 赤10個100円 http //akizukidenshi.com/catalog/g/gI-02383/ 緑10個100円 http //akizukidenshi.com/catalog/g/gI-02476/ フルカラー1個100円 http //akizukidenshi.com/catalog/g/gI-00684/ 大型フルカラーLED(35mA) EP204K-35G1R1B1-CA 200円 抵抗 http //akizukidenshi.com/catalog/c/crd16s_dB_spop/ 100,220,470,1k,2.2k,4.7k,10k,22k,47k,100k E3系列 10種類*100円 150,330,680,1.5k,3.3k,6.8k,15k,33k,68k E6系列 9種類*100円 スイッチ類 http //akizukidenshi.com/catalog/g/gP-02561/ タクトスイッチ(大)10個セット 300円 http //akizukidenshi.com/catalog/g/gP-01282/ タクトスイッチ 100個セット 700円 可変抵抗 http //akizukidenshi.com/catalog/g/gP-00244/ 小型ボリューム 1KΩB 40円 http //akizukidenshi.com/catalog/goods/search.aspx?search=x keyword=%8f%ac%8c%5e%83%7b%83%8a%83%85%81%5b%83%80 http //akizukidenshi.com/catalog/g/gP-02690/ 半固定ボリューム 100KΩ(10個入) 200円 http //akizukidenshi.com/catalog/g/gP-02470/ 半固定ボリューム 10KΩ(10個入) 200円 http //akizukidenshi.com/catalog/g/gP-02689/ 半固定ボリューム 5KΩ(10個入) 200円 http //akizukidenshi.com/catalog/g/gP-02631/ 半固定ボリューム 1KΩ(10個入) 200円 センサー 温度センサー http //akizukidenshi.com/catalog/g/gI-02726/ 高精度IC温度センサ LM61CIZ(4個入) 200円 CdSセル http //akizukidenshi.com/catalog/g/gI-00110/ CDSセル 5mmタイプ 40円 http //akizukidenshi.com/catalog/c/ccds/ 焦電型赤外線センサ http //akizukidenshi.com/catalog/g/gI-00243/ 焦電型赤外線センサ AKE−1(RE−210) 100円 赤外線受信モジュール http //akizukidenshi.com/catalog/g/gI-00622/ 赤外線リモコン受信モジュール PL−IRM0101(38kHz)シールド付 110円 http //akizukidenshi.com/catalog/c/cired/ サウンド/ディスプレイ 圧電スピーカー http //akizukidenshi.com/catalog/g/gP-01251/ 圧電スピーカー(2個入) 100円 http //akizukidenshi.com/catalog/c/cbz/ ディスプレイ http //sc.akizukidenshi.com/catalog/g/gP-00038/ LCDキャラクタディスプレイモジュール(16×2行バックライト付) 700円 http //sc.akizukidenshi.com/catalog/g/gP-00036/ LCDキャラクタディスプレイモジュール 20×4行バックライト付き 1500円 http //sc.akizukidenshi.com/catalog/g/gP-01675/ 超小型LCDキャラクタディスプレイモジュール(16×2行バックライト緑) 900円 http //sc.akizukidenshi.com/catalog/g/gP-01797/ 超小型LCDキャラクタディスプレイモジュール(16×2行バックライト・オレンジ) 900円 http //akizukidenshi.com/catalog/g/gI-00963/ 赤色LEDドットマトリクス(8×8)38x38mm 100円 http //akizukidenshi.com/catalog/g/gI-00889/ 2色(赤・緑)LEDドットマトリクス(8×8) BU5004-RG 200円 http //akizukidenshi.com/catalog/g/gI-01393/ 7セグLED 赤色2文字(アノードコモン)足長タイプ(4個入) 100円 さらに トランジスタ http //akizukidenshi.com/catalog/g/gI-02611/ トランジスタ 2SC1815Y(20個入) 100円 http //akizukidenshi.com/catalog/g/gI-02612/ トランジスタ 2SA1015Y(20個入) 100円 http //akizukidenshi.com/catalog/g/gI-01516/ トランジスタアレイ TD62083AP(2個入)100円 http //akizukidenshi.com/catalog/g/gI-01587/ トランジスタアレイ TD62003AP(2個入)100円 赤外線LED 5mm(100個入) 700円 http //akizukidenshi.com/catalog/g/gI-00656/ 3軸加速度センサモジュール http //akizukidenshi.com/catalog/g/gI-01425/ KXM52−1050 1000円 http //akizukidenshi.com/catalog/g/gI-02347/ KXP84−2050 1200円 リアルタイムクロックモジュール http //akizukidenshi.com/catalog/g/gI-00233/ 500円 シャント・レギュレータ TL431(10個入) 100円 http //akizukidenshi.com/catalog/g/gI-01434/ FET http //akizukidenshi.com/catalog/c/cfet/ ダイオード 汎用整流用ダイオード 1N4007 1000V 1A(20本入) 100円 http //akizukidenshi.com/catalog/g/gI-00934/ 汎用小信号高速スイッチング・ダイオード 1N4148(50本入) 100円 http //akizukidenshi.com/catalog/g/gI-00941/ オペアンプ 汎用オペアンプ NJM4558DD(5個入) 200円 http //akizukidenshi.com/catalog/g/gI-02357/ 汎用オペアンプ NJM2043DD(4個入) 250円 http //akizukidenshi.com/catalog/g/gI-02369/ さらにさらに モーター サーボ その他 9V電池スナップ http //akizukidenshi.com/catalog/g/gP-00452/ ACアダプタ5V http //akizukidenshi.com/catalog/g/gM-00238/ http //akizukidenshi.com/catalog/g/gM-01801/ コイル http //akizukidenshi.com/catalog/c/ccoil/ PFMステップアップDC/DCコンバータ HT7750A(5個入) http //akizukidenshi.com/catalog/g/gI-02800/ SRAM 256K SRM2B256SLMX55(5個入り) 5個300円 http //akizukidenshi.com/catalog/g/gI-01461/ SOP28ピン(1.27mm)DIP変換基板 80円 http //akizukidenshi.com/catalog/g/gP-02615/ 23K256-DIP8 SPIインターフェースで利用する256Kbit(32KB)のSRAMです。 * 最大クロック:20MHz * 電源:2.7-3.6V http //www.microfan.jp/shop/6_104.html http //blog.goo.ne.jp/sim00/e/13a62f29e59fb569cacd661883e70bf7 非接触回転速度センサ OH182/E 2個300円 http //akizukidenshi.com/catalog/g/gI-01657/
https://w.atwiki.jp/arduino/pages/39.html
(todo) たぶん、mega88pには http //www.geocities.jp/arduino_diecimila/bootloader/ にあるavrdude.confの更新が必要。 http //www.geocities.jp/arduino_diecimila/bootloader/files/avrdude.conf 引用↓ 追記2:ATmega328Pにブートローダを書くときの情報 … [続きを見る] 新しいavrdude.confをダウンロードしてください。 (ATmega328PとATmega88Pのチップ情報を追加してあります) 以下のヒューズの値,ロックビットの値,ブートローダのhexファイルを使ってください。(arduino-0013\hardware\board.txtより) * hfuse = DA * lfuse = FF * efuse = 05 * unlock = 3F * lock = 0F * bootloader .hex file arduino-0013(or 0014)\hardware\bootloaders\atmega168\ATmegaBOOT_168_atmega328.hex #------------------------------------------------------------ # ATmega88P #------------------------------------------------------------ part id = "m88p"; desc = "ATMEGA88P"; has_debugwire = yes; flash_instr = 0xB6, 0x01, 0x11; eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF, 0x99, 0xF9, 0xBB, 0xAF; stk500_devcode = 0x73; # avr910_devcode = 0x; signature = 0x1e 0x93 0x0f; pagel = 0xd7; bs2 = 0xc2; chip_erase_delay = 9000; pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; timeout = 200; stabdelay = 100; cmdexedelay = 25; synchloops = 32; bytedelay = 0; pollindex = 3; pollvalue = 0x53; predelay = 1; postdelay = 1; pollmethod = 1; pp_controlstack = 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; resetdelayus = 0; hvleavestabdelay = 15; resetdelay = 15; chiperasepulsewidth = 0; chiperasepolltimeout = 10; programfusepulsewidth = 0; programfusepolltimeout = 5; programlockpulsewidth = 0; programlockpolltimeout = 5; memory "eeprom" paged = no; page_size = 4; size = 512; min_write_delay = 3600; max_write_delay = 3600; readback_p1 = 0xff; readback_p2 = 0xff; read = " 1 0 1 0 0 0 0 0", " 0 0 0 0 0 0 a9 a8", " a7 a6 a5 a4 a3 a2 a1 a0", " o o o o o o o o"; write = " 1 1 0 0 0 0 0 0", " 0 0 0 0 0 0 a9 a8", " a7 a6 a5 a4 a3 a2 a1 a0", " i i i i i i i i"; loadpage_lo = " 1 1 0 0 0 0 0 1", " 0 0 0 0 0 0 0 0", " 0 0 0 0 0 0 a1 a0", " i i i i i i i i"; writepage = " 1 1 0 0 0 0 1 0", " 0 0 0 0 0 0 a9 a8", " a7 a6 a5 a4 a3 a2 0 0", " 0 0 0 0 0 0 0 0"; mode = 0x41; delay = 5; blocksize = 4; readsize = 256; ; memory "flash" paged = yes; size = 8192; page_size = 64; num_pages = 128; min_write_delay = 4500; max_write_delay = 4500; readback_p1 = 0xff; readback_p2 = 0xff; read_lo = " 0 0 1 0 0 0 0 0", " 0 0 0 0 a11 a10 a9 a8", " a7 a6 a5 a4 a3 a2 a1 a0", " o o o o o o o o"; read_hi = " 0 0 1 0 1 0 0 0", " 0 0 0 0 a11 a10 a9 a8", " a7 a6 a5 a4 a3 a2 a1 a0", " o o o o o o o o"; loadpage_lo = " 0 1 0 0 0 0 0 0", " 0 0 0 0 0 0 0 0", " x x x a4 a3 a2 a1 a0", " i i i i i i i i"; loadpage_hi = " 0 1 0 0 1 0 0 0", " 0 0 0 0 0 0 0 0", " x x x a4 a3 a2 a1 a0", " i i i i i i i i"; writepage = " 0 1 0 0 1 1 0 0", " 0 0 0 0 a11 a10 a9 a8", " a7 a6 a5 x x x x x", " 0 0 0 0 0 0 0 0"; mode = 0x41; delay = 6; blocksize = 64; readsize = 256; ; memory "lfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", "0 0 0 0 0 0 0 0 o o o o o o o o"; write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", "0 0 0 0 0 0 0 0 i i i i i i i i"; ; memory "hfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", "0 0 0 0 0 0 0 0 o o o o o o o o"; write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", "0 0 0 0 0 0 0 0 i i i i i i i i"; ; memory "efuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", "0 0 0 0 0 0 0 0 x x x x x x x o"; write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", "0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 i"; ; memory "lock" size = 1; min_write_delay = 4500; max_write_delay = 4500; read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", "0 0 0 0 0 0 0 0 x x o o o o o o"; write = "1 0 1 0 1 1 0 0 1 1 1 0 0 0 0 0", "0 0 0 0 0 0 0 0 1 1 i i i i i i"; ; memory "calibration" size = 1; read = "0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0", "0 0 0 0 0 0 0 0 o o o o o o o o"; ; memory "signature" size = 3; read = "0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0", "0 0 0 0 0 0 a1 a0 o o o o o o o o"; ; ; #------------------------------------------------------------ # ATmega328P #------------------------------------------------------------ part id = "m328p"; desc = "ATMEGA328P"; has_debugwire = yes; flash_instr = 0xB6, 0x01, 0x11; eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00, 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF, 0x99, 0xF9, 0xBB, 0xAF; stk500_devcode = 0x86; # avr910_devcode = 0x; signature = 0x1e 0x95 0x0F; pagel = 0xd7; bs2 = 0xc2; chip_erase_delay = 9000; pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1", "x x x x x x x x x x x x x x x x"; chip_erase = "1 0 1 0 1 1 0 0 1 0 0 x x x x x", "x x x x x x x x x x x x x x x x"; timeout = 200; stabdelay = 100; cmdexedelay = 25; synchloops = 32; bytedelay = 0; pollindex = 3; pollvalue = 0x53; predelay = 1; postdelay = 1; pollmethod = 1; pp_controlstack = 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F, 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F, 0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B, 0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; resetdelayus = 0; hvleavestabdelay = 15; resetdelay = 15; chiperasepulsewidth = 0; chiperasepolltimeout = 10; programfusepulsewidth = 0; programfusepolltimeout = 5; programlockpulsewidth = 0; programlockpolltimeout = 5; memory "eeprom" paged = no; page_size = 4; size = 1024; min_write_delay = 3600; max_write_delay = 3600; readback_p1 = 0xff; readback_p2 = 0xff; read = " 1 0 1 0 0 0 0 0", " 0 0 0 x x x a9 a8", " a7 a6 a5 a4 a3 a2 a1 a0", " o o o o o o o o"; write = " 1 1 0 0 0 0 0 0", " 0 0 0 x x x a9 a8", " a7 a6 a5 a4 a3 a2 a1 a0", " i i i i i i i i"; loadpage_lo = " 1 1 0 0 0 0 0 1", " 0 0 0 0 0 0 0 0", " 0 0 0 0 0 0 a1 a0", " i i i i i i i i"; writepage = " 1 1 0 0 0 0 1 0", " 0 0 x x x x a9 a8", " a7 a6 a5 a4 a3 a2 0 0", " x x x x x x x x"; mode = 0x41; delay = 5; blocksize = 4; readsize = 256; ; memory "flash" paged = yes; size = 32768; page_size = 128; num_pages = 256; min_write_delay = 4500; max_write_delay = 4500; readback_p1 = 0xff; readback_p2 = 0xff; read_lo = " 0 0 1 0 0 0 0 0", " 0 0 a13 a12 a11 a10 a9 a8", " a7 a6 a5 a4 a3 a2 a1 a0", " o o o o o o o o"; read_hi = " 0 0 1 0 1 0 0 0", " 0 0 a13 a12 a11 a10 a9 a8", " a7 a6 a5 a4 a3 a2 a1 a0", " o o o o o o o o"; loadpage_lo = " 0 1 0 0 0 0 0 0", " 0 0 0 x x x x x", " x x a5 a4 a3 a2 a1 a0", " i i i i i i i i"; loadpage_hi = " 0 1 0 0 1 0 0 0", " 0 0 0 x x x x x", " x x a5 a4 a3 a2 a1 a0", " i i i i i i i i"; writepage = " 0 1 0 0 1 1 0 0", " 0 0 a13 a12 a11 a10 a9 a8", " a7 a6 x x x x x x", " x x x x x x x x"; mode = 0x41; delay = 6; blocksize = 128; readsize = 256; ; memory "lfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0", "x x x x x x x x o o o o o o o o"; write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0", "x x x x x x x x i i i i i i i i"; ; memory "hfuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0", "x x x x x x x x o o o o o o o o"; write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0", "x x x x x x x x i i i i i i i i"; ; memory "efuse" size = 1; min_write_delay = 4500; max_write_delay = 4500; read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0", "x x x x x x x x x x x x x o o o"; write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0", "x x x x x x x x x x x x x i i i"; ; memory "lock" size = 1; min_write_delay = 4500; max_write_delay = 4500; read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0", "x x x x x x x x x x o o o o o o"; write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x", "x x x x x x x x 1 1 i i i i i i"; ; memory "calibration" size = 1; read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x", "0 0 0 0 0 0 0 0 o o o o o o o o"; ; memory "signature" size = 3; read = "0 0 1 1 0 0 0 0 0 0 0 x x x x x", "x x x x x x a1 a0 o o o o o o o o"; ; ;
https://w.atwiki.jp/arduino/pages/62.html
Chanさんの「赤外線リモコン制御モジュール」 http //elm-chan.org/fsw/irctrl/00index.html をArduinoのライブラリにしてみました。 ライブラリとして2つのファイルを配置してください。 libraries/IrCtrl/IrCtrl.cpp libraries/IrCtrl/IrCtrl.h Counter1とTimer2を使うのでArduino標準のPWMがいくつか使えなくなっているはずです。 サンプルスケッチ IrCtrlTest.pde #include Debounce.h #include IrCtrl.h int PIN_LED = 13; int PIN_IR_IN = 8; // PB0 ICP1 Counter1 int PIN_IR_OUT = 3; // PD3 OC2B Timer2 int PIN_BUTTON_1 = 2; Debounce button1 = Debounce(20, PIN_BUTTON_1); void setup() { Serial.begin(115200); pinMode(PIN_LED, OUTPUT); pinMode(PIN_BUTTON_1, INPUT); digitalWrite(PIN_BUTTON_1, HIGH); // pull-up pinMode(PIN_IR_OUT, OUTPUT); pinMode(PIN_IR_IN, INPUT); digitalWrite(PIN_IR_IN, HIGH); // pull-up IR_initialize(); Serial.println("IR remote control test program"); } void loop() { // digitalWrite(PIN_LED, !digitalRead(PIN_IR)); ir_recv_loop(); if(button1.update() !button1.read()){ if (IR_xmit(AEHA, (uint8_t*)"\xAA\x5A\x8F\x12\x14\xF1", 6*8)){ Serial.println("OK AQUOS VOLUME UP"); } } } void ir_recv_loop(void) { if(IrCtrl.state!=IR_RECVED){ return; } uint8_t d, i, l; uint16_t a; l = IrCtrl.len; switch (IrCtrl.fmt) {/* Which frame arrived? */ #if IR_USE_NEC case NEC /* NEC format data frame */ if (l == 32) {/* Only 32-bit frame is valid */ Serial.print("N "); Serial.print(IrCtrl.buff[0], HEX); Serial.print(" "); Serial.print(IrCtrl.buff[1], HEX); Serial.print(" "); Serial.print(IrCtrl.buff[2], HEX); Serial.print(" "); Serial.print(IrCtrl.buff[3], HEX); Serial.println(); } break; case NEC|REPT /* NEC repeat frame */ Serial.println("N repeat"); break; #endif #if IR_USE_AEHA case AEHA /* AEHA format data frame */ if ((l = 48) (l % 8 == 0)) {/* Only multiple of 8 bit frame is valid */ Serial.print("A"); l /= 8; for (i = 0; i l; i++){ Serial.print(" "); Serial.print(IrCtrl.buff[i], HEX); } Serial.println(); } break; case AEHA|REPT /* AEHA format repeat frame */ Serial.println("A repeat"); break; #endif #if IR_USE_SONY case SONY d = IrCtrl.buff[0]; a = ((uint16_t)IrCtrl.buff[2] 9) + ((uint16_t)IrCtrl.buff[1] 1) + ((d 0x80) ? 1 0); d = 0x7F; switch (l) {/* Only 12, 15 or 20 bit frames are valid */ case 12 //xprintf(PSTR("S12 %u %u\n"), d, a 0x1F); Serial.print("S12 "); Serial.print(d, HEX); Serial.print(" "); Serial.print(a 0x1F, HEX); Serial.println(); break; case 15 //xprintf(PSTR("S15 %u %u\n"), d, a 0xFF); Serial.print("S15 "); Serial.print(d, HEX); Serial.print(" "); Serial.print(a 0xFF, HEX); Serial.println(); break; case 20 //xprintf(PSTR("S20 %u %u\n"), d, a 0x1FFF); Serial.print("S20 "); Serial.print(d, HEX); Serial.print(" "); Serial.print(a 0x1FFF, HEX); Serial.println(); break; } break; #endif } IrCtrl.state = IR_IDLE;/* Ready to receive next frame */ }